package com.vishnu.main;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

import com.vishnu.pojo.Address;
import com.vishnu.pojo.AddressId;
import com.vishnu.pojo.Employee;

public class UsingCompositeKey {
	public static void main(String[] args) {
		Configuration cfg =new Configuration();
		cfg.configure("hib.cfg.xml");
		SessionFactory sf=cfg.buildSessionFactory();
		Session hsession=sf.openSession();
		Transaction tx=hsession.beginTransaction();
		
/*		Employee employee=new Employee();
		employee.setEmployeeId(3);
		employee.setEmployeeName("savithramma");
		employee.setEmployeeSalary(7544.);
		hsession.save(employee);*/
		
/*		Address adress=new Address();
		AddressId adressId=new AddressId();
		adressId.setAid(1);
		adressId.setEno(6);
		adress.setAddressId(adressId);
		adress.setStreetName("pantai");
		adress.setState("kl");
		adress.setCountry("malay");
		
		hsession.save(adress);	*/	
		
		
		tx.commit();
		hsession.close();
		sf.close();
	}
}
